<html>
<head><meta charset="utf-8"><title>Is there already an issue open for this bug? · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Is.20there.20already.20an.20issue.20open.20for.20this.20bug.3F.html">Is there already an issue open for this bug?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="243238604"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Is%20there%20already%20an%20issue%20open%20for%20this%20bug%3F/near/243238604" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> ruster <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Is.20there.20already.20an.20issue.20open.20for.20this.20bug.3F.html#243238604">(Jun 19 2021 at 08:59)</a>:</h4>
<p>When renaming a crate in a <code>foo = { package = "actual_crate_name", version = "0.2" }</code>-fashion, it is still possible for the <code>actual_crate_name</code> to be leaked through "unexpected type" errors. So for instance instead of  "expected struct <code>X</code>, found struct <code>foo::util::X</code>" it would say "expected struct <code>X</code>, found struct <code>actual_crate_name::util::X</code>". I'm having a hard time reproducing this issue outside my project when simplifying it so I was wondering if this issue is already open somewhere on the bug tracker?<br>
Or is this perhaps expected behavior?</p>



<a name="243253984"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Is%20there%20already%20an%20issue%20open%20for%20this%20bug%3F/near/243253984" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Is.20there.20already.20an.20issue.20open.20for.20this.20bug.3F.html#243253984">(Jun 19 2021 at 15:04)</a>:</h4>
<p>I have not seen that reported before, feel free to open an issue.</p>
<p>Here is a reproduction if you want:</p>
<div class="codehilite" data-code-language="TOML"><pre><span></span><code><span class="k">[dependencies]</span>
<span class="n">json</span> <span class="o">=</span> <span class="p">{</span><span class="n">version</span><span class="o">=</span><span class="s">"*"</span><span class="p">,</span> <span class="n">package</span><span class="o">=</span><span class="s">"serde_json"</span><span class="p">}</span>
</code></pre></div>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">enum</span> <span class="nc">Value</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>
<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">x</span>: <span class="nc">Value</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">json</span>::<span class="n">Value</span>::<span class="n">Null</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>
<div class="codehilite"><pre><span></span><code>error[E0308]: mismatched types
 --&gt; src/main.rs:3:20
  |
3 |     let x: Value = json::Value::Null;
  |            -----   ^^^^^^^^^^^^^^^^^ expected enum `Value`, found enum `serde_json::Value`
  |            |
  |            expected due to this
</code></pre></div>
<p>I think in this particular case, E0308  tries to shorten the path if it is unambiguous, and I suspect it is that path shortening which uses the "real" crate name instead of the resolve-based name.  I see other errors use the resolve path.  Since this is done in typechecking, I'm not sure if the resolver information is readily available, though.</p>



<a name="243296773"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Is%20there%20already%20an%20issue%20open%20for%20this%20bug%3F/near/243296773" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> ruster <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Is.20there.20already.20an.20issue.20open.20for.20this.20bug.3F.html#243296773">(Jun 20 2021 at 10:22)</a>:</h4>
<p>Thanks! Couldn't quite manage to reproduce it when isolated but this example works</p>



<a name="243297308"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Is%20there%20already%20an%20issue%20open%20for%20this%20bug%3F/near/243297308" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> ruster <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Is.20there.20already.20an.20issue.20open.20for.20this.20bug.3F.html#243297308">(Jun 20 2021 at 10:38)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/issues/86485">https://github.com/rust-lang/rust/issues/86485</a></p>



<a name="244090617"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Is%20there%20already%20an%20issue%20open%20for%20this%20bug%3F/near/244090617" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Esteban Küber <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Is.20there.20already.20an.20issue.20open.20for.20this.20bug.3F.html#244090617">(Jun 27 2021 at 23:35)</a>:</h4>
<p>Because we use the full path to the <em>original</em> definition in all errors, path names for reexports and renames can always leak. A "recent" change checks wether the name of a type is globally unique and if so only shows the name, but to properly fix this we would need the diagnostics machinery to be aware of the locally accessible name for every DefId, and we don't do that now (and have delayed doing it due to mem consumption concerns)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>